package com.sbr.seb.wicket.page;

import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;

import com.sbr.seb.entity.alter.Alter;
import com.sbr.seb.entity.alter.Schema;
import com.sbr.seb.entity.alter.enumeration.AlterAction;
import com.sbr.seb.wicket.page.administration.AddAlter;

/**
 * Homepage
 */
public class SuiviAlters extends BasePage {

    public SuiviAlters() {
    	super();
    	List<Alter> alterList = new ArrayList<Alter>();
    	alterList.add(new Alter(0, AlterAction.ALTER, new Schema(1, "ADMINISTRE"), "17", "22/02/2010", "alter 17 de commun"));
    	alterList.add(new Alter(1, AlterAction.IMPORT_PRODUCTION, new Schema(2, ""), "17", "22/02/2010", "import de production de l'instance OCANQ"));
    	
    	add(new Label("instance", "OCANQ"));
    	add(new ListView<Alter>("alterList", alterList) {

			@Override
			protected void populateItem(ListItem<Alter> item) {
				Alter alter = item.getModelObject();
				item.add(new Label("name", alter.getName()));
				item.add(new Label("action", alter.getAction().name()));
				item.add(new Label("description", alter.getDescription()));
				item.add(new Label("installationDate", alter.getInstallationDate()));
				item.add(new Label("schema", alter.getSchema().getName()));
				
			}
    		
    	});
    	
    	add(new BookmarkablePageLink("addAlterLink", AddAlter.class));
    	
    }
}
